﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace SFP.Animation2D
{
    public class MotionPath
    {
        private List<PathPoint> path;
        private float pathLength = 0;
        private int pathIndex = 0;

        public PointF StartPoint {
            get
            {
                return new PointF(path[0].X, path[0].Y);
            }

            set
            {
                path[0].X = value.X;
                path[0].Y = value.Y;
            }
        }
        public PointF PositionOnPath { get; private set; }
        private double _pathPercent;
        public double PathPercent
        {
            get
            {
                return _pathPercent;
            }
            set
            {
                _pathPercent = value;
                
            }
        }

        public MotionPath(PointF absStartPoint)
        {
            path.Add(new PathPoint(absStartPoint, PathPointType.Absolute));
            PositionOnPath = absStartPoint;
            PathPercent = 0;
        }

        public void AddPathPoint(PathPoint pathPoint)
        {
            path.Add(pathPoint);
        }

        public void RemoveLastPathPoint()
        {
            if (path.Count > 1) path.RemoveAt(path.Count - 1);
        }

        public void ClearPath()
        {
            path.Clear();
        }
    }
}
